import wx


class MyFrame(wx.Frame):

    def __init__(self, style):
        super().__init__(parent=None, id=-1, title="Frame sytle", pos=(400, 300), size=(800, 500), style=style)
        panel = wx.Panel(self)
        panel.SetBackgroundColour("green")

        statusBar = self.CreateStatusBar()  # 创建状态栏
        toolBar = self.CreateToolBar()  # 创建工具栏
        # toolBar.AddTool(-1, "New", wx.Image('../resouce/wxPython.jpg', wx.BITMAP_TYPE_JPEG).ConvertToBitmap(),
        #                 "LongHelpfor'New'")

        bitmap = wx.Image('../resouce/favicon.ico', wx.BITMAP_TYPE_ICO).ConvertToBitmap()
        bitmap.SetSize((10, 10))
        toolBar.AddTool(-1, "New", bitmap, "LongHelpfor'New'")
        toolBar.AddTool(-1, "New", bitmap, "LongHelpfor'New'")
        toolBar.Realize()

        menuBar = wx.MenuBar()
        menu1 = wx.Menu()
        menuBar.Append(menu1, "&FIle")
        menu2 = wx.Menu()
        menu2.Append(-1, "&Copy", helpString="Copy in status bar")
        menu2.Append(-1, "C&ut", "")
        menu2.Append(-1, "Paste", "")
        menu2.AppendSeparator()
        menu2.Append(-1, "&Options", "Display Options")
        menuBar.Append(menu2, "&Edit")
        self.SetMenuBar(menuBar)

    def OnCloseMe(self, event):
        self.Close(True)

    def OnCloseWindow(self, event):
        self.Destroy()


class MyApp(wx.App):

    def OnInit(self):
        self.frame = MyFrame(wx.DEFAULT_FRAME_STYLE)
        self.frame.Show()
        self.SetTopWindow(self.frame)
        return True


if __name__ == '__main__':
    app = MyApp()
    app.MainLoop()
